<?php
namespace addons\cloudstorage;

use think\Addons;
use think\Db;

class Install extends Addons
{
    public function install()
    {
        $sql = <<<SQL
CREATE TABLE IF NOT EXISTS `fa_cloud_storage` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `type` varchar(20) NOT NULL COMMENT '存储类型',
  `name` varchar(50) NOT NULL COMMENT '配置名称',
  `config` text NOT NULL COMMENT '配置参数',
  `domain` varchar(255) DEFAULT NULL COMMENT '访问域名',
  `is_default` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否默认',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态',
  `createtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `updatetime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  PRIMARY KEY (`id`),
  KEY `type` (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='云存储配置表';
SQL;
        Db::execute($sql);
        return true;
    }

    public function uninstall()
    {
        Db::execute('DROP TABLE IF EXISTS `fa_cloud_storage`');
        return true;
    }
}
?>
